//
//  LinkageSlidingPageViewController.m
//  project-demo-oc
//
//  Created by 赵隆杰 on 2021/6/2.
//

#import "LinkageSlidingPageViewController.h"
#import "LinkageSlidingListViewController.h"

#define menuViewHeight 50

@interface LinkageSlidingPageViewController ()

@end

@implementation LinkageSlidingPageViewController

- (instancetype)init {
    self = [super init];
    if (self) {
        self.menuViewStyle = WMMenuViewStyleLine;
        self.progressHeight = 2;
        self.titleSizeNormal = 16;
        self.titleSizeSelected = 16;
        self.titleColorSelected = [UIColor redColor];
        self.titleColorNormal = [UIColor blackColor];
        self.progressColor = [UIColor redColor];
        self.titles = @[@"第一", @"第二", @"第三", @"第四"];
    }
    
    return self;
}

- (NSInteger)numbersOfChildControllersInPageController:(WMPageController *)pageController {
    return self.titles.count;
}

- (UIViewController *)pageController:(WMPageController *)pageController viewControllerAtIndex:(NSInteger)index {
    LinkageSlidingListViewController *vc = [[LinkageSlidingListViewController alloc] init];
    vc.index = index;
    return vc;
}

- (NSString *)pageController:(WMPageController *)pageController titleAtIndex:(NSInteger)index {
    return self.titles[index];
}

- (CGRect)pageController:(WMPageController *)pageController preferredFrameForMenuView:(WMMenuView *)menuView
{
    return CGRectMake(0, 0, SL_WINDOW_WIDTH, menuViewHeight);
}

- (CGRect)pageController:(WMPageController *)pageController preferredFrameForContentView:(WMScrollView *)contentView
{
    return CGRectMake(0, menuViewHeight, SL_WINDOW_WIDTH, self.view.frame.size.height - menuViewHeight);
}

@end
